﻿Imports System.Web
Imports Mysoft.Map.Data
Imports Mysoft.Map.Application
Imports System.Data
Imports System.Data.OleDb
Imports System.Data.SqlClient
Imports System.Xml
Imports Mysoft.Slxt.Business
Imports System.IO
Imports Mysoft.PubProject.Business

Partial Public Class BizParam_SaleManagerSet_XMLHTTP
    Inherits System.Web.UI.Page
    Dim MyBizParamMNG As New Mysoft.PubProject.Business.BizParamMNG
    Dim MySaleMNG As New Mysoft.Slxt.Business.SaleMNG
    Dim MyRoomMNG As New Mysoft.Slxt.Business.RoomMNG
    Dim MyBankMNG As New Mysoft.Slxt.Business.BankMNG
    Dim MyOrder As New Mysoft.Slxt.Business.Order
    Dim MyPubMng As New Mysoft.PubProject.Business.PublicMNG
    Dim strSQL As String

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim strYwType As String                 '业务类型
        Dim strOnlyFlag, strTxt As String       'resquest值
        Dim strReturn As String = ""            '返回值

        strYwType = Request.QueryString("ywtype")           '业务标识
        strOnlyFlag = Request.QueryString("ywonlyflag")     '唯一键值
        strTxt = Request.QueryString("ywtxt")               '其它参数值
        strYwType = Request.QueryString("ywtype")

        '接收post的长文本值
        Dim strLongText As String = ""                      'POST文本
        If Request.InputStream.Length > 0 Then
            Dim b(Request.InputStream.Length - 1) As Byte
            Request.InputStream.Read(b, 0, Request.InputStream.Length)
            strLongText = System.Text.Encoding.UTF8.GetString(b)
        End If


        Select Case strYwType.ToUpper
            Case "SaveSaleManagerList".ToUpper                                '保存前台用户添加的记录到销售经理表中
                strReturn = SaveSaleManagerList(strLongText)
                Exit Select
        End Select

        MyBase.Response.ContentType = "text/HTML"
        MyBase.Response.Clear()
        MyBase.Response.Write(strReturn)      ' 返回操作成功信息
        MyBase.Response.End()
    End Sub

#Region "业务处理代码"

    '保存前台用户添加的记录到销售经理表中
    Private Function SaveSaleManagerList(ByVal a_strPostValue As String) As String
        Try
            Dim strSQL As String = ""
            strSQL = String.Format("DELETE s_SaleManager;")

            If a_strPostValue <> String.Empty And a_strPostValue <> "" Then
                strSQL &= String.Format("INSERT INTO s_SaleManager(SaleManagerGUID,StationGUID) SELECT newid(),StationGUID FROM myStation WHERE StationGUID IN ('{0}')", a_strPostValue.Replace(",", "','"))
            End If

            If MyDB.ExecSQL(strSQL) > -1 Then
                Return "OK"
            Else
                Return "操作失败.请与管理员联系!"
            End If
        Catch ex As Exception
            Return "操作失败.请与管理员联系!"
        End Try
    End Function

#End Region

End Class